
#pragma once

#ifndef CLIB_THRD_H
#define CLIB_THRD_H

#include <threads.h>
#include "clib_spinlock.h"
#include "clib_cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct clib_thrd_s {
    thrd_t              tid;
    i32_t               idx;
    clib_cpu_info_t     cpu;
    thrd_start_t        work;
    void               *args;
    clib_spinlock_t     lock;
    i32_t               start;
    i32_t               statue;
} clib_thrd_t;

i32_t clib_thrd_init(clib_thrd_t *thrd);

i32_t clib_thrd_join(clib_thrd_t *thrd);

#ifdef __cplusplus
}
#endif

#endif 